<%@page import="cn.ticket.Constant"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="cn.ticket.db.DBConnect"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加车次</title>
</head>
<body>
	<jsp:include page="/front/common/head.jsp"></jsp:include>
	<%
	String userId= (String)session.getAttribute("login_user_id") ;
	String ticketId = (String)request.getParameter("id") ;
	Connection con =  new DBConnect().getConnection()  ;
	String sql = "select status from ticket where id =? " ;
	PreparedStatement pstmt = con.prepareStatement(sql) ;
	pstmt.setString(1,ticketId) ;
	
	ResultSet rs = pstmt.executeQuery() ;
	if(rs.next()){
		sql = "update ticket set status=4 where id=?" ;
		PreparedStatement ps = con.prepareStatement(sql) ;
		ps.setString(1, ticketId) ;
		ps.executeUpdate() ;
		ps.close() ;
		%>
		<jsp:forward page="/front/ticket/orderList.jsp?result=success"/>
	<%
	}else{
		session.setAttribute("errorinfo", Constant.ERRORINFO_NETERROR) ;
		%>
			<jsp:forward page="/front/result.jsp"/>
		<%
	}
	con.close() ;
	%>
</body>
</html>